﻿using ICSharpCode.NRefactory.CSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace ATTAR
{
    public class ECHOFileParser
    {
        #region Fields
        
        private ECHOElements elements;
        
        #endregion

        public ECHOFileParser()
        {
        }

        public SyntaxTree Parse(string fileName)
        {
            string code = GetFileContents(fileName);

            var parser = new CSharpParser();
            SyntaxTree syntaxTree = parser.Parse(code, "file.cs");
            if (parser.HasErrors)
            {
            }

            return syntaxTree;
        }

        private string GetFileContents(string fileName)
        {
            StreamReader reader;
            string code = string.Empty;

            using (reader = new StreamReader(fileName))
            {
                code = reader.ReadToEnd();
            }

            return code;
        }        
    }
}
